<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%String contextPath = request.getContextPath();%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>渠县信息管理局平台服务端</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/md5.js"></script>

<script type="text/javascript">

function login(){
	
	if(document.getElementById("userName").value==""){
		alert("用户名不能为空.");
		return false;
	}
	if(document.getElementById("password").value==""){
		alert("密码不能为空.");
		return false;
	}
	if(document.getElementById("verificationCode").value==""){
		alert("验证码不能为空.");
		return false;
	}
	var hash = MD5(document.getElementById("password").value);
	document.getElementById("password").value = hash;    
    
	document.forms[0].action = "<%=contextPath%>/adminlogin/login.action"; 
	document.forms[0].submit();
	}
	
	
function changeValidateCode(obj) {    
	
	//获取当前的时间作为参数，无具体意义    
	var timenow = new Date().getTime();    
	//每次请求需要一个不同的参数，否则可能会返回同样的验证码    
	//这和浏览器的缓存机制有关系，也可以把页面设置为不缓存，这样就不用这个参数了。    
	obj.src="<%=contextPath%>/adminlogin/rand.action?d="+timenow;    
}    

</script>
</head>
<body background="${pageContext.request.contextPath}/images/bg.png">
<center>
<form method="post" name="from1" id="from1">
<input id="version" name="version" type="hidden" value="1" />
<div style="height: 130px"></div>
<center>
				<table>
					<tr height="40px">
						<td width="80px"><div style="color: #000000; font-weight: bold;">用户名：</div></td>
						<td><input id="userName" name="userName" value="${userName}" maxlength="16" type="text" style="width:200px; height:20px; padding-left:6px; font-size:12px;"/></td>
					</tr>
					<tr height="40px">
						<td  width="80px"><div style="color: #00000; font-weight: bold;">密      码：</div></td>
						<td><input id="password" name="password" maxlength="6" type="password" style="width:200px; height:20px; padding-left:6px; font-size:12px"/></td>
					</tr>
					<tr>
						<td>
							<div style="color: #00000; font-weight: bold;">验证码：</div>
						</td>
						<td>

							<input id="verificationCode" maxlength="6" name="verificationCode" type="text" style="width:200px; height:20px; padding-left:6px; font-size:12px"/>
							<img src="${pageContext.request.contextPath}/adminlogin/rand.action"  onclick="changeValidateCode(this)" title="点击图片刷新验证码"/>
						</td>
					</tr>
					<tr>
						<td></td>
						<td align="left"><input type="button" value="登  录" style="width:210px;" id="bc" onclick="login()"/></td>
					</tr>
					<tr>
						<td></td>
						<td align="left"><font style="color: #ff0000">${errorMessage}</font></td>
					</tr>
				</table>
</center>

</div>
</form>
</center>

</body>
</html>

